package cn.edu.scujcc;

import java.util.List;
import java.util.Optional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/living")
public class LivingController {
	@Autowired
	private LivingService service;
	
	@GetMapping
	public List<Living> getAllBilibili(){
		List<Living> result = null;
		result = service.getAllBilibili();
		return result;
	}
	
	@GetMapping("/{id}")
	public Living getIntro(@PathVariable User id) {
		Living result = null;
		result = service.getIntro(id);
		return result;
	}
	
	@PostMapping
	public Living newBilibili(@RequestBody Living b) {
		Living result = null;
		result = service.newBilibili(b);
		return result;
	}
	
	@GetMapping("/share/{id}")
	public Living getShares(@PathVariable User id) {
		Living result = null;
		result = service.getShares(id);
		return result;
	}
	
	@GetMapping("/follow/{id}")
	public Living getFollows(@PathVariable User id) {
		Living result = null;
		result = service.getFollows(id);
		return result;
	}
}
